<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>点赞(1)</button>
    <button>点赞(1)</button>
    <button>点赞(1)</button>
    <script>
        var btns=document.querySelectorAll('button');
            function clicks(){
                var num=1;
                return function(){
                    num++;
                    this.innerText="点赞("+num+")";
                }
            }
            for(var i=0;i<btns.length;i++){
                btns[i].onclick=clicks();
            }
        function randNum(){
            var num=parseInt(Math.random()*100);
            return function(){
                console.log(num);
            }    
        }
        var fun=randNum();
            fun();
            fun();
            fun();


    </script>
    
</body>
</html>